<?php

namespace App\Entity\Trade;

use ApiPlatform\Core\Annotation\ApiResource;
use App\Base\Annotation\Common;
use App\Entity\User;
use App\Repository\Trade\OrderPackTradeRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;

/**
 * @ApiResource()
 * @ORM\Entity(repositoryClass=OrderPackTradeRepository::class)
 */
class OrderPackTrade
{
    /**
     * @Common(cnName="#",listType="text",editType="text")
     * @ORM\Id()
     * @ORM\GeneratedValue()
     * @ORM\Column(type="integer")
     * @Groups({"pack"})
     */
    private $id;

    /**
     * @Common(cnName="用户",listType="text",editType="text",width="150")
     * @ORM\ManyToOne(targetEntity=User::class)
     * @Groups({"pack"})
     */
    private $user;

    /**
     * @Common(cnName="订单",listType="text",editType="text",width="")
     * @ORM\ManyToOne(targetEntity=OrderTrade::class, inversedBy="packs")
     * @Groups({"pack"})
     */
    private $orders;

    /**
     * @Common(cnName="产品",listType="text",editType="entity",width="")
     * @ORM\ManyToOne(targetEntity=ProductTrade::class)
     * @ORM\JoinColumn(nullable=false)
     * @Groups({"pack"})
     */
    private $product;

    /**
     * @Common(cnName="单价",listType="text",editType="text")
     * @ORM\Column(type="float")
     * @Groups({"pack"})
     */
    private $price;

    /**
     * @Common(cnName="数量",listType="text",editType="text")
     * @ORM\Column(type="float")
     * @Groups({"pack"})
     */
    private $num;

    /**
     * @Common(cnName="合计",listType="text",editType="text")
     * @ORM\Column(type="float")
     * @Groups({"pack"})
     */
    private $total;

    /**
     * @Common(cnName="包装",listType="text",editType="text")
     * @ORM\Column(type="string", length=255, nullable=true)
     * @Groups({"pack"})
     */
    private $tips;

    /**
     * @Common(cnName="状态",listType="text",editType="text",width="150")
     * @ORM\Column(type="integer")
     * @Groups({"pack"})
     */
    private $status;

    /**
     * @Common(cnName="下单时间",listType="text",editType="text",width="200")
     * @ORM\Column(type="datetime", nullable=true)
     * @Groups({"pack"})
     */
    private $createAt;

    public function getId(): ?int
    {
        return $this->id;
    }

    public function getUser(): ?User
    {
        return $this->user;
    }

    public function setUser(?User $user): self
    {
        $this->user = $user;

        return $this;
    }

    public function getOrders(): ?OrderTrade
    {
        return $this->orders;
    }

    public function setOrders(?OrderTrade $orders): self
    {
        $this->orders = $orders;

        return $this;
    }

    public function getProduct(): ?ProductTrade
    {
        return $this->product;
    }

    public function setProduct(?ProductTrade $product): self
    {
        $this->product = $product;

        return $this;
    }

    public function getPrice(): ?float
    {
        return $this->price;
    }

    public function setPrice(float $price): self
    {
        $this->price = $price;

        return $this;
    }

    public function getNum(): ?float
    {
        return $this->num;
    }

    public function setNum(float $num): self
    {
        $this->num = $num;

        return $this;
    }

    public function getTotal(): ?float
    {
        return $this->total;
    }

    public function setTotal(float $total): self
    {
        $this->total = $total;

        return $this;
    }

    public function getTips(): ?string
    {
        return $this->tips;
    }

    public function setTips(?string $tips): self
    {
        $this->tips = $tips;

        return $this;
    }

    public function getStatus(): ?int
    {
        return $this->status;
    }

    public function setStatus(int $status): self
    {
        $this->status = $status;

        return $this;
    }

    public function getCreateAt(): ?\DateTimeInterface
    {
        return $this->createAt;
    }

    public function setCreateAt(?\DateTimeInterface $createAt): self
    {
        $this->createAt = $createAt;

        return $this;
    }
}
